<html>
	<head>
		<link  rel="stylesheet" href="__CSS__/discussdetail_style.css" type="text/css">
		<link rel="stylesheet" href="__JS__/kindeditor/themes/default/default.css" />
		<link rel="stylesheet" href="__JS__/kindeditor/plugins/code/prettify.css" />
		<script charset="utf-8" src="__JS__/kindeditor/kindeditor.js"></script>
		<script charset="utf-8" src="__JS__/kindeditor/lang/zh_CN.js"></script>
		<script charset="utf-8" src="__JS__/kindeditor/plugins/code/prettify.js"></script> 
		<script>
			KindEditor.ready(function(K) {
				var editor1 = K.create('textarea[name="text"]', {
					cssPath : '__JS__/kindeditor/plugins/code/prettify.css',
					uploadJson : '__JS__/kindeditor/php/upload_json.php?no={$no}',
					fileManagerJson : '__JS__/kindeditor/php/file_manager_json.php?no={$no}',
					allowFileManager : true,
					afterCreate : function() {
						var self = this;
						K.ctrl(document, 13, function() {
							self.sync();
							K('form[name=discuss]')[0].submit();
						});
						K.ctrl(self.edit.doc, 13, function() {
							self.sync();
							K('form[name=discuss]')[0].submit();
						});
					}
				});
				prettyPrint();
			});
		</script>
		<title>讨论区</title>
		<load href= "__JS__/jshelper.js" /> 
		<script type="text/JavaScript">
			function discussdelete(id,courseid){
				if (confirm("你确定要删除吗")==true) {
					//posthelper([["id",id],],'__URL__/discussdelete');
					postwith('__URL__/discussdelete',{id:id,courseid:courseid});
				}
			}
			function show(){
				var tab=document.getElementById("tab");
									var tr=tab.getElementsByTagName("tr");
								for(var i=0;i<=tr.length;i++){
								if(i%2==0){
									tr[i].style.backgroundColor="#fff";
								}else{
									tr[i].style.backgroundColor="#f0f0f0";	
									}
								}
							}
					window.onload=show;
		
		</script>
		<load href="__JS__/jQuery/jquery.js" />
       	<load href="__JS__/jQuery/jquery.form.js" />
		<script type="text/JavaScript">
        $(function(){
            $('#form1').ajaxForm({
                //beforeSubmit:  function(){alert("before");},  // pre-submit callback
                success:       complete,  // post-submit callback
                error:function(){alert("error");},
                dataType: 'json'
            });
            
            function complete(data){
                if (data.status==1)
                {
                	window.location=window.location.href;
                }else{
                    $('#result').html(data.info).show();
                }
            }
        });
        </script>
	</head>
	<body>	
		<layout name="Auth:header" />
		<iframe src="__URL__/menu" style="position:absolute; left:40px; top:350px; width:180px; height:190px;" frameborder=”no” border=”0″ marginwidth=”0″ marginheight=”0″ scrolling=”no”></iframe>
		<div  style="position:relative; top:-70px; left:240px; font-size:12px; width:60%;">
		当前位置：
		<a href='__APP__/index/index'>主页</a>>
		<a href='__URL__/index'>课程展示</a>>
		<a href='__URL__/course/id/{$courseid}'>{$coursename}</a>>
		讨论区
		</div>
		<div id="discuss_Show" style="width:68%; position:relative; left:200px;" >
		
			<table width="100%" border="0" align="center" cellpadding="0px" cellspacing="0px;">
				<thead  style=" font-weight:bold; font-size:12px; background-color:f0f0f0;">
					<tr id="table_discuss_show_title" style="height:35px;">
						<td style="width:45%">标题</td>
						<td style="width:15%">作者</td>
						<td style="width:20%">发表时间</td>
						<td style="width:4%">点击</td>
						<td style="width:4%">回复</td>
						<if condition='$a eq 0'>
						<else/>
						<td style="width:50px">操作</td>
						</if>
					</tr>
				</thead>
				<load href"__PUBLIC__/js/list_show.js">
				<tbody id="tab">
					<volist name='list' id='vo' >
						<tr id="table_discuss_show"  style="height:35px;">
							<td style="display:none;">{$vo.id}</td>	<!--ID-->
							<td style="width:45%"><a href="__URL__/discusstopic/id/{$vo.id}">{$vo.name}</a></td><!--标题-->
							<td style="width:15%">{$vo.nname}</td><!--作者-->
							<td style="width:20%;">{$vo.time}</td><!--发表时间-->
							<td style="width:4%;">{$vo.pv}</td><!--访问量-->
							<td style="width:4%;">{$vo.count}</td><!--回复量-->
							<if condition='$a eq 0'>	
							<else/>
							<td style="width:180px;">
								<a href="#"  name="delete_discuss" onClick="discussdelete({$vo.id},{$vo.courseid})" style=" font-size:12px;">删除</a>
							</td>
							</if>
							</td>
						</tr>
					</volist>
				</tbody>		
			</table>
			<div class="green-black" align="right" style="position:relative; top:35px;">{$page}</div>
               <div style="position:relative; top:50px;">
                    <if condition="$role eq '访客'"> 访客不能发帖！
                      <else/>
                      	
                        <form id='form1' name="discuss" method="post" action="__URL__/discussadd" >
							<div id='result' style="color:red; font-size:12px;"></div>
	                        <input type='hidden' name='courseid' value={$courseid}>
	                       	 标题
	                        <input type="text" name="name" style="width:350px;">
	                        <br>
	                        <textarea name="text" style="width:850px;hight:1000px;"></textarea>
	                        <br>
							<div align="right" style="width:850px">
	                        <input name="submit" type="submit" value="发表" >
							</div>
                        </form>
                    </if>
                 </div>
		</div>
	</body>
</html>